package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.*;
import dao.impl.Jingdong_classDaoImpl;
import entity.Jingdong_class;
import entity.Jingdong_product;
import entity.Jingdong_product_category;
import service.Jingdong_productService;
import service.Jingdong_product_categoryService;
import service.impl.Jingdong_productServiceImpl;
import service.impl.Jingdong_product_categoryServiceImpl;

/**
 * Servlet implementation class Jingdong_classSys
 */
@WebServlet("/Jingdong_classSys")
public class Jingdong_classSys extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		System.out.println("----进入 servlet Jingdong_classSys AAAA -------------");
		Jingdong_classDao jingdong_classDao = new Jingdong_classDaoImpl();   //商品分类
		Jingdong_product_categoryService jpcS = new Jingdong_product_categoryServiceImpl();  //右侧栏
		Jingdong_productService jsP = new Jingdong_productServiceImpl();  //商品信息
		List<Jingdong_product_category> s = jpcS.categoryList();   //查询右侧栏信息
		List<Jingdong_class> listClass = jingdong_classDao.classList();  //查询全部商品分类信息
		List<Jingdong_product> adsg = jsP.danjiaList(1);   //大牌
		List<Jingdong_product> adad = jsP.listProduct();  //全部信息
		request.setAttribute("adad", adad);
		request.setAttribute("adsg", adsg);
		request.setAttribute("s", s);
		request.setAttribute("listClass", listClass);
		request.getRequestDispatcher("indexs.jsp").forward(request, response);
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		doGet(request, response);
	}
}
